import {createRouter, createWebHistory} from 'vue-router'

const routes = [
    {
        path: '/',
        component: () => import('../view/Layout.vue'),
        children: [
            {
                path: '',
                name: 'Home',
                component: () => import('../view/Home.vue'),
                meta: {title: '首页', keepAlive: true}
            },
            {
                path: 'classification',
                name: 'Classification',
                component: () => import('../view/Classification.vue'),
                meta: {title: '分类'}
            },
            {
                path: 'search',
                name: 'Search',
                component: () => import('../view/Search.vue'),
                meta: {title: '搜索'}
            },
            {
                path: 'cart',
                name: 'Cart',
                component: () => import('../view/Cart.vue'),
                meta: {title: '购物车'}
            },
            {
                path: 'detail/:id',
                name: 'Detail',
                component: () => import('../view/Detail.vue'),
                meta: {title: '商品详情'}
            },
            {
                path: 'order',
                name: 'Order',
                component: () => import('../view/Order.vue'),
                meta: {title: '确认订单'}
            },
            {
                path: 'order-success',
                name: 'OrderSuccess',
                component: () => import('../view/OrderSuccess.vue'),
                meta: {title: '订单成功'}
            },
            {
                path: 'message',
                name: 'Message',
                component: () => import('../view/Message.vue'),
            },
            {
                path: 'dd',
                name: 'Dd',
                component: () => import('../view/ClientOrder.vue')
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router
